<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">url
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<!-- <link rel="stylesheet" href=""> -->

</head>
<body>
	<input type="url" name="urls" value="" placeholder="please enter a url...">
	<input type="email" name="email" ng-model="user.email" />
</body>
<script type="text/javascript">
	/**    Function inherit(p)**/
	function inherit(p){
		if(p==null) throw TypeError();
		if(Object.create)
			return Object.create(p);
		var t = typeof(p);
		if(t!=="object" && t !== "function") throw TypeError();
		function f(){};
		f.prototype = p ;
		return new f();
	};

	function copy(o,p){
		p = p || {};
		return p =Object.create(o);
	}
	var o = {x:1};
	var p = copy(o);
	p.x = 2;
	//alert(p.x+" "+o.x);

	/**  getter,setter   **/
	var p2 = {
		x:1.0,
		y:1.0,
		get r(){
			return Math.sqrt(this.x*this.x + this.y*this.y);
		},
		set r(newValue){
			var oldValue = Math.sqrt(this.x*this.x + this.y*this.y);
			var ratio = newValue/oldValue;
			this.x  *= ratio;
			this.y *= ratio;
		},
		get theta(){
			return Math.atan2(this.y , this.x);
		},
	};
	var q = inherit(p2);
	q.x = 1;
	q.y = 1;
	console.log(q.r);
	console.log(Object.getOwnPropertyDescriptor(Object.prototype,"constructor"));

	/**  Global object **/
	function getGlobalObject(){
		return (function(){
			return this;
		}).call(null);
	}
	console.log(getGlobalObject());

	
	function getObjectFN(){
		for(prop in Object){
			
		}
	}
	console.log(Object.constructor);
	console.log(Object.getOwnPropertyNames(Object));
	//extend(p,q);

	/** selfdefine extend() **/
	Object.defineProperty(Object.prototype,"extend",{
		writable:true,
		enumerable : false,
		configurable : true,
		value : function(o){
			var names = Object.getOwnPropertyNames(o);
			for (var i = 0; i < names.length; i++) {
				if(names[i] in this) continue;
				var desc = Object.getOwnPropertyDescriptor(o,names[i]);
				Object.defineProperty(this,names[i],desc);
			};
		}
	});
	console.log(Object.getOwnPropertyNames(Object.prototype));

	/**  getPrototypeOf()  /  isPrototypeOf()  **/
	console.log(Object.getPrototypeOf(p.constructor.prototype));
	console.log(p.__proto__);

	/**  classof() get class attribute  **/
	function classof(o){
		if(o === null){
			return "Null";
		}
		if(o === undefined) return "Undefined";
		return Object.prototype.toString.call(o).slice(8,-1);
	}
	console.log(classof("p"));
	console.log(Object.getOwnPropertyNames(JSON.stringify));
	

	var a = [];
	a[3]= 3;
	a[4.000] = 6;
	console.log(a.length);

	var  xx =function(){

	};
	console.log(xx.prototype);

	function identity($){
		return $;
	}
	identity.$inject = [];
	console.log(identity.$inject);
</script>
</html>